import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/component_information_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/change_overhaul_record_entity.dart';


ComponentInformationEntity $ComponentInformationEntityFromJson(Map<String, dynamic> json) {
  final ComponentInformationEntity componentInformationEntity = ComponentInformationEntity();
  final String? changeCycle = jsonConvert.convert<String>(json['changeCycle']);
  if (changeCycle != null) {
    componentInformationEntity.changeCycle = changeCycle;
  }
  final String? checkCycle = jsonConvert.convert<String>(json['checkCycle']);
  if (checkCycle != null) {
    componentInformationEntity.checkCycle = checkCycle;
  }
  final List<ChangeOverhaulRecordEntity>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ChangeOverhaulRecordEntity>(e) as ChangeOverhaulRecordEntity).toList();
  if (children != null) {
    componentInformationEntity.children = children;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    componentInformationEntity.companyCode = companyCode;
  }
  final String? componentName = jsonConvert.convert<String>(json['componentName']);
  if (componentName != null) {
    componentInformationEntity.componentName = componentName;
  }
  final String? componentsUsed = jsonConvert.convert<String>(json['componentsUsed']);
  if (componentsUsed != null) {
    componentInformationEntity.componentsUsed = componentsUsed;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    componentInformationEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    componentInformationEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    componentInformationEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    componentInformationEntity.deleted = deleted;
  }
  final String? deviceId = jsonConvert.convert<String>(json['deviceId']);
  if (deviceId != null) {
    componentInformationEntity.deviceId = deviceId;
  }
  final String? deviceTypeName = jsonConvert.convert<String>(json['deviceTypeName']);
  if (deviceTypeName != null) {
    componentInformationEntity.deviceTypeName = deviceTypeName;
  }
  final int? verificationCycle = jsonConvert.convert<int>(json['verificationCycle']);
  if (verificationCycle != null) {
    componentInformationEntity.verificationCycle = verificationCycle;
  }
  final String? deviceName = jsonConvert.convert<String>(json['deviceName']);
  if (deviceName != null) {
    componentInformationEntity.deviceName = deviceName;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    componentInformationEntity.id = id;
  }
  final String? manufacturer = jsonConvert.convert<String>(json['manufacturer']);
  if (manufacturer != null) {
    componentInformationEntity.manufacturer = manufacturer;
  }
  final String? sparePartCode = jsonConvert.convert<String>(json['sparePartCode']);
  if (sparePartCode != null) {
    componentInformationEntity.sparePartCode = sparePartCode;
  }
  final String? specsCode = jsonConvert.convert<String>(json['specsCode']);
  if (specsCode != null) {
    componentInformationEntity.specsCode = specsCode;
  }
  final String? changeStatus = jsonConvert.convert<String>(json['changeStatus']);
  if (changeStatus != null) {
    componentInformationEntity.changeStatus = changeStatus;
  }
  final String? checkStatus = jsonConvert.convert<String>(json['checkStatus']);
  if (checkStatus != null) {
    componentInformationEntity.checkStatus = checkStatus;
  }
  final String? verificationStatus = jsonConvert.convert<String>(json['verificationStatus']);
  if (verificationStatus != null) {
    componentInformationEntity.verificationStatus = verificationStatus;
  }
  final String? unitName = jsonConvert.convert<String>(json['unitName']);
  if (unitName != null) {
    componentInformationEntity.unitName = unitName;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    componentInformationEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    componentInformationEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    componentInformationEntity.updateDate = updateDate;
  }
  return componentInformationEntity;
}

Map<String, dynamic> $ComponentInformationEntityToJson(ComponentInformationEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['changeCycle'] = entity.changeCycle;
  data['checkCycle'] = entity.checkCycle;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  data['companyCode'] = entity.companyCode;
  data['componentName'] = entity.componentName;
  data['componentsUsed'] = entity.componentsUsed;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['deviceId'] = entity.deviceId;
  data['deviceTypeName'] = entity.deviceTypeName;
  data['verificationCycle'] = entity.verificationCycle;
  data['deviceName'] = entity.deviceName;
  data['id'] = entity.id;
  data['manufacturer'] = entity.manufacturer;
  data['sparePartCode'] = entity.sparePartCode;
  data['specsCode'] = entity.specsCode;
  data['changeStatus'] = entity.changeStatus;
  data['checkStatus'] = entity.checkStatus;
  data['verificationStatus'] = entity.verificationStatus;
  data['unitName'] = entity.unitName;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension ComponentInformationEntityExtension on ComponentInformationEntity {
  ComponentInformationEntity copyWith({
    String? changeCycle,
    String? checkCycle,
    List<ChangeOverhaulRecordEntity>? children,
    String? companyCode,
    String? componentName,
    String? componentsUsed,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? deviceId,
    String? deviceTypeName,
    int? verificationCycle,
    String? deviceName,
    String? id,
    String? manufacturer,
    String? sparePartCode,
    String? specsCode,
    String? changeStatus,
    String? checkStatus,
    String? verificationStatus,
    String? unitName,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return ComponentInformationEntity()
      ..changeCycle = changeCycle ?? this.changeCycle
      ..checkCycle = checkCycle ?? this.checkCycle
      ..children = children ?? this.children
      ..companyCode = companyCode ?? this.companyCode
      ..componentName = componentName ?? this.componentName
      ..componentsUsed = componentsUsed ?? this.componentsUsed
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..deviceId = deviceId ?? this.deviceId
      ..deviceTypeName = deviceTypeName ?? this.deviceTypeName
      ..verificationCycle = verificationCycle ?? this.verificationCycle
      ..deviceName = deviceName ?? this.deviceName
      ..id = id ?? this.id
      ..manufacturer = manufacturer ?? this.manufacturer
      ..sparePartCode = sparePartCode ?? this.sparePartCode
      ..specsCode = specsCode ?? this.specsCode
      ..changeStatus = changeStatus ?? this.changeStatus
      ..checkStatus = checkStatus ?? this.checkStatus
      ..verificationStatus = verificationStatus ?? this.verificationStatus
      ..unitName = unitName ?? this.unitName
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}
